<?php
/* @var $this CategorieController */
/* @var $model Categories */

$this->breadcrumbs=array(
	'Categories'=>array('index'),
	'Create',
);

$this->menu=array(
	array('label'=>'List Categories', 'url'=>array('index')),
	array('label'=>'Manage Categories', 'url'=>array('admin')),
);
?>

<?php
$cs = Yii::app ()->clientScript;
$cs->registerScript('#yw0',
"
		$(document).ready(function(){
		   $('#yw0 li:last').addClass('current');
		});
"
);
?>
<div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>管理分类</h3>
        <ul class="content-box-tabs">
          <li><a href="<?php echo $this->createUrl('/backend/categorie')?>">分类列表</a></li>
          <li><a  class="default-tab current" href="<?php echo $this->createUrl('/backend/addcategorie')?>">增加分类</a></li>
        </ul>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content" id="tab1">
        <fieldset></fieldset>        
		</div>

        <div class="tab-content default-tab current" id="tab2">         
            <fieldset>
			<?php $form=$this->beginWidget('CActiveForm', array(
			'id'=>'categories-form',
			'enableAjaxValidation'=>false,
			'htmlOptions' => array('enctype' => 'multipart/form-data'),
				
		)); ?>
		
			<p class="note">带 <span class="required">*</span> 为必填项目.</p>
		
			<?php
			echo $form->errorSummary($model);
			?>
		
			<div class="row">
				<?php echo $form->labelEx($model,'分类名'); ?>
				<?php echo $form->textField($model,'name',array('class' => 'text-input small-input')); ?>
				<?php echo $form->error($model,'name'); ?>
			</div>
			
			<div class="row">
				<?php echo $form->labelEx($model,'父分类'); ?>
				<?php //echo $form->textField($model,'parent',array('size'=>11,'maxlength'=>11)); 
						//echo $form->dropDownlist($model,'parent',CHtml::listData($model,'parent','name'));
						//$model->attributes['parent'];
						$list = CHtml::listData(Categories::model()->findAll(array('order' => 'id')), 'id', 'name');				
						echo $form->dropDownList($model,'parent',$list);		
					?>
				<?php echo $form->error($model,'parent'); ?>
			</div>
		
			<div class="row">
				<?php echo $form->labelEx($model,'分类封面'); ?>
				<?php echo $form->fileField($model,'category_image_url',array('class' => 'text-input small-input')); ?>
				<?php echo $form->error($model,'category_image_url'); ?>
			</div>
			
			
			<div class="row">
			<?php echo $form->labelEx($model,'排序号'); ?>			
			<?php echo $form->textField($model,'ordering',array('class' => 'text-input small-input')); ?>
			<?php echo $form->error($model,'ordering'); ?>
			</div>
			
		
				<?php echo $form->hiddenField($model,'description',array('type'=>"hidden" , 'value'=>"")); ?>			
				<?php echo $form->error($model,'description'); ?>
		
				<?php echo $form->hiddenField($model,'param',array('type'=>"hidden" , 'value'=>"")); ?>		
				<?php echo $form->error($model,'param'); ?>
		
		
			<div class="row">
				<?php echo $form->labelEx($model,'发布状态'); ?>
				<?php
					//$list = CHtml::listData(Categories::model()->findAll(array('order' => 'id')), 'id', 'published');
					$list = array( "1"=> "发布", "0" => "关闭");		
					echo $form->dropDownList($model,'published',$list);
				?>
				<?php echo $form->error($model,'published'); ?>
			</div>
		
			<div class="row buttons">
				<?php echo CHtml::submitButton('增加'); ?>
			</div>
		
		<?php $this->endWidget(); ?>
            </fieldset>
            <div class="clear"></div>
            <!-- End .clear -->          
        </div>
        <!-- End #tab2 -->
      </div>
      <!-- End .content-box-content -->
    </div>
    <!-- End .content-box -->